package egovframework.npqs.pqi.mobile.util;

import android.util.Log;
import egovframework.npqs.pqi.mobile.common.CommonGlobal;

public class LogUtil {

	public static final int LOG_DISABLE = 0;
	
	public static int LOG_MODE = Log.DEBUG;
	
	public static void d(String tag, String msg){
		switch(logModeSetting(CommonGlobal.log_mode)) {
			case LOG_DISABLE :
				break;
			case Log.ASSERT :
				break;
			case Log.DEBUG :
				Log.d(tag, msg);
				break;
			case Log.ERROR:
				Log.e(tag, msg);
				break;
			case Log.INFO :
				Log.i(tag, msg);
				break;
			case Log.VERBOSE:
				Log.v(tag, msg);
				break;
			case Log.WARN :
				Log.w(tag, msg);
				break;
			default :
				break;
		}
	}
	
	public static void e(String tag, String msg){
		if(CommonGlobal.LOG_E_MODE){
			Log.e(tag, msg);
		}
	}
	
	public static void w(String tag, String msg){
		if(CommonGlobal.LOG_E_MODE){
			Log.w(tag, msg);
		}
	}
	
	public static void sysout(String print) {
		switch(logModeSetting(CommonGlobal.log_mode)) {
		case LOG_DISABLE :
			break;
		case Log.ASSERT :
			break;
		case Log.DEBUG :
			System.out.println(print);
			break;
		case Log.ERROR:
			System.out.println(print);
			break;
		case Log.INFO :
			System.out.println(print);
			break;
		case Log.VERBOSE:
			System.out.println(print);
			break;
		case Log.WARN :
			System.out.println(print);
			break;
		default :
			break;
		}
	}
	
	public static int logModeSetting(boolean realFlag){
		return (realFlag)?LOG_DISABLE:LOG_MODE;
	}
}
